let express = require('express');
let router = express.Router();
let config = require('../conf/config');
let request = require('request');

/* GET home page. */
router.all('/*', function (req, res, next) {
	request(config.apiPath + req.path, (error, response, body) => {
		if (!error) {
			let info = JSON.parse(body);
			res.json(info);
		} else {
			res.json({ error, response, body });
		}
	});

});

module.exports = router;
